Untyped Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Given a generic IList<T> interface, wrap a non-generic (untyped) IList interface around it. The non-generic interface will contain the same objects as the underlying generic list, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IList Untyped<T>(
	IList<T> typedList
)
Visual Basic (Declaration)
Public Shared Function Untyped(Of T) ( _
	typedList As IList(Of T) _
) As IList
Visual C++
public:
generic<typename T>
static IList^ Untyped (
	IList<T>^ typedList
)

Parameters

typedList
IList<(Of <T>)>
A typed list to wrap.

Return Value

A non-generic IList wrapper around typedList. If typedList is null, then null is returned.

Type Parameters

T
The item type of the underlying list.

Remarks

Many generic collections already implement the non-generic interfaces directly. This method will first attempt to simply cast typedList to IList. If that succeeds, it is returned; if it fails, then a wrapper object is created.

See Also